libxl: event system: Make libxl_sigchld_owner_libxl_always work
authorIan Jackson <ian.jackson@eu.citrix.com>
Tue, 5 Nov 2013 16:43:59 +0000 (16:43 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 21 Nov 2013 18:47:24 +0000 (18:47 +0000)
commit755aa9edb274f6f69a7afaffa399c70eb8205369
tree5d60442f5cb0b22e79787d1ebc33bade3cc252f0
parent5d2f96adc8fd0ca99bcb6b83b2b557769b13fc26
libxl: event system: Make libxl_sigchld_owner_libxl_always work

Previously, libxl_sigchld_owner_libxl_always was mishandled.  It would
result in libxl paying no attention to the sigchld self pipe.

Fix this by fixing chldmode_ours so that it returns true iff we are
supposed to be handling SIGCHLD.

Additionally, we arrange to use chldmode_ours everywhere where we are
installing/removing signal handlers and/or deciding whether to check
the self pipe, etc.  This means it needs a new "creating" flag
argument for the benefit of libxl__ev_child_fork, which needs to
install the signal handler in libxl_sigchld_owner_libxl even if there
are not currently any children.

ctx->childproc_hooks->chldowner is now interpreted only by
chldmode_ours.

Reported-by: Bamvor Jian Zhang <bjzhang@suse.com>
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Bamvor Jian Zhang <bjzhang@suse.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Jim Fehlig <jfehlig@suse.com>
---
v2: Get sense of chldmode test right in perhaps_removehandler (!)
tools/libxl/libxl_fork.c